<?php
namespace app\adminmall\controller;
use app\adminmall\model\RecelogModel;
use app\common\controller\AdminBaseController;
use think\Config;
use think\Db;

/**
 * 收款记录
 * Class Member
 * @package app\admin\controller
 */
class RecelogController extends AdminBaseController {
    protected $model;

    protected function _initialize() {
        parent::_initialize();
        $this->model = new RecelogModel();
    }

    /**
     * 收款记录
     * @param int    $page
     * @return mixed
     */
    public function index($page = 1) {
        $list = $this->model->paginate(10);
        return $this->fetch('index', ['list' => $list]);
    }
        
    /**
     * 搜索查询
     */
    public function search(){
    	$map = [];
		$field = 'm.*,m.id,m.name';		    	
    	if(request()->isPost()){
		 	$param = input('post.');		
			//用户名称
			if($param['name']){
				$map['m.name'] = ['like', '%'.$param['name'].'%'];
			}	
			//状态
			if($param['status']!=0 ){
				$map['status'] = ['like', '%'.$param['status'].'%'];
			}
			//创建时间
			if($param['add_time']&&$param['end_time']){
				$map['m.add_time'] = ['between time', [$param['add_time'],$param['end_time']]];
			}					
	 	}
		$list=Db::name("mall_recelog")->alias('m')->field($field)->where($map)->paginate(10);
        return $this->fetch('index', ['list' => $list]);
    }
}